#pragma once
#ifndef __G_OBSERVABLE_H__
#define __G_OBSERVABLE_H__

#include <vector>

#include "GTypes.h"
#include "GObserver.h"
#include "GBitContainer.h"

namespace GUtil
{	
	class GObservable
	{
	typedef std::vector<GObserver*>	ObserverList;

	private:
		ObserverList	Observers;
		GObserverType	ObserverMask;

	protected:
						GObservable();
		virtual			~GObservable();

	public:
		void			SetObserverMask(GObserverType ObserverMask);
		GObserverType	GetObserverMask() const;

		void			AppendObserver(GObserver* Observer);
		void			RemoveObserver(GObserver* Observer);

		bool			CanNotifyObserver(GObserver* Observer) const;
		void			NotifyObservers(GMessageId Message, void* Data);

	}; // class GObservable

}; // namespace GUtil

#endif // __G_OBSERVABLE_H__